#include <cstdio>
#include <ctime>
#include <cstdlib>

int mpow( int a, int i, int n )
{
    if ( i == 0 )
        return 1;
    long long x = mpow( a, i / 2, n );
    if ( x == 0 )
        return 0;
    long long y = x * x % n;
    if ( y == 1 && x != 1 && x != n - 1 )
        return 0;
    if ( i & 1 )
        y = a * y % n;
    return y;
}

bool Miller_Rabin( int s )
{
    int i;
    if ( s == 2 || s == 3 )
        return true;
    if ( s == 4 || s == 1 )
        return false;
    for ( i = 0; i < 3; i++ )
    {
        if ( mpow( rand( )%( s - 4 ) + 2, s - 1, s ) != 1 )
            return false;
    }
    return true;
}

int main( )
{
    srand( time( NULL ) );
    int n, t, c;
    while ( scanf("%d", &n) != EOF )
    {
        c = 0;
        while ( n-- )
        {
            scanf("%d", &t);
            if ( Miller_Rabin( t ) )
                c++;
        }
        printf("%d\n", c);
    }
    return 0;
}
